//=============================================================================
// TFParaTBomb
//=============================================================================
class TFParaTBomb extends TFProjectile;

var	emitter trail;
var vector initialDir;

simulated function PostBeginPlay()
{
	local Rotator R;

	if ( !PhysicsVolume.bWaterVolume && (Level.NetMode != NM_DedicatedServer) )
	{
		Trail=Spawn(class'Onslaught.ONSAttackCraftStreamer',self);
        trail.SetBase(self);
    }

	Super.PostBeginPlay();
	Velocity = Vector(Rotation) * Speed;
	R = Rotation;
	R.Roll = 32768;
	SetRotation(R);
	Velocity.z += TossZ;
	initialDir = Velocity;
}

simulated function destroyed()
{
	if (Trail!=None)
		Trail.Kill();
	Super.Destroyed();
}

simulated function Tick(float dt)
{
    setrotation(rotator(velocity));
}

simulated function ProcessTouch(Actor Other, Vector HitLocation)
{
	if ( Other != Instigator && tfparatbomb(other)==none)
	{
		SpawnEffects(HitLocation, -1 * Normal(Velocity) );
		Explode(HitLocation,Normal(HitLocation-Other.Location));
	}
}

simulated function SpawnEffects( vector HitLocation, vector HitNormal )
{
    local actor fx;

	PlaySound(sound'ONSVehicleSounds-S.Explosion06',,6,,750);

	if ( EffectIsRelevant(Location,false) )
	{
		fx=spawn(class'OnslaughtFull.ONSAutoBomberBombExplosion',,,HitLocation + HitNormal*16 );
		fx=spawn(class'FlashExplosion',,,HitLocation + HitNormal*16 );
		fx.setdrawscale(fx.drawscale*3);

		if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
			Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal)).setdrawscale(4);
	}
}

simulated function Landed( vector HitNormal )
{
	SpawnEffects( Location, HitNormal );
	Explode(Location,HitNormal);
}

simulated function HitWall (vector HitNormal, actor Wall)
{
	Landed(HitNormal);
}

function BlowUp(vector HitLocation)
{
	HurtRadius(250, 650, MyDamageType, MomentumTransfer, HitLocation);
	MakeNoise(1.0);
}

simulated function Explode(vector HitLocation, vector HitNormal)
{
	local vector start;

	start = Location + 10 * HitNormal;
	BlowUp(start);

    Destroy();
}

defaultproperties
{
     Speed=100.000000
     TossZ=-50.000000
     bSwitchToZeroCollision=True
     Damage=90.000000
     MomentumTransfer=100000.000000
     MyDamageType=Class'taskforces.DamTypeBomber'
     ImpactSound=ProceduralSound'WeaponSounds.PGrenFloor1.P1GrenFloor1'
     ExplosionDecal=Class'XEffects.RocketMark'
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'VMWeaponsSM.PlayerWeaponsGroup.bomberBomb'
     Physics=PHYS_Falling
     LifeSpan=10.000000
     DrawScale=0.175000
     AmbientGlow=100
     SoundVolume=255
     SoundRadius=150.000000
     bProjTarget=True
     ForceType=FT_Constant
     ForceRadius=60.000000
     ForceScale=5.000000
}
